<?php

declare(strict_types=1);

/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */

use App\Agent\RedisQueueAgent;
use App\Constants\RedisKey;
use Hyperf\Utils\ApplicationContext;

return [
    'default'  => [
        'handler'   => [
            'class'       => Monolog\Handler\RotatingFileHandler::class,
            'constructor' => [
                'filename' => BASE_PATH . '/runtime/logs/default.log',
                'level'    => Monolog\Logger::WARNING,
            ],
        ],
        'formatter' => [
            'class'       => Monolog\Formatter\LineFormatter::class,
            'constructor' => [
                'dateFormat'            => 'Y-m-d H:i:s',
                'allowInlineLineBreaks' => true,
            ]
        ]
    ],
    'apiadmin' => [
        'handler'   => [
            'class'       => Monolog\Handler\RedisHandler::class,
            'constructor' => [
                'redis' => (ApplicationContext::getContainer())->get(RedisQueueAgent::class),
                'key'   => RedisKey::QUEUE_API_LOG
            ]
        ],
        'formatter' => [
            'class'       => Monolog\Formatter\LineFormatter::class,
            'constructor' => [
                'dateFormat'            => 'Y-m-d H:i:s',
                'allowInlineLineBreaks' => true
            ]
        ]
    ],
    'paylog'   => [
        'handler'   => [
            'class'       => Monolog\Handler\RedisHandler::class,
            'constructor' => [
                'redis' => (ApplicationContext::getContainer())->get(RedisQueueAgent::class),
                'key'   => RedisKey::QUEUE_PAY_LOG
            ]
        ],
        'formatter' => [
            'class'       => Monolog\Formatter\LineFormatter::class,
            'constructor' => [
                'dateFormat'            => 'Y-m-d H:i:s',
                'allowInlineLineBreaks' => true
            ]
        ]
    ]
];
